#ifndef PURCHASEORDERLISTDIALOG_H
#define PURCHASEORDERLISTDIALOG_H

#include <QDialog>
#include <QCloseEvent>
#include <QSqlQueryModel>
namespace Ui {
class PurchaseOrderListDialog;
}

class PurchaseOrderListDialog : public QDialog
{
    Q_OBJECT

public:
    explicit PurchaseOrderListDialog(QWidget *parent = nullptr);
    ~PurchaseOrderListDialog();
signals:
    //自定义信号,通知主窗口对话框已经关闭
    void poListDialogClosed();
private slots:
    void on_buttonBox_accepted();

    void on_buttonBox_rejected();
    //加载采购订单列表数据
    void refreshOrderList();
    //打开订单详情对话框
    void onViewDetailsClicked();
    //打开履约编辑框
    void onEditFulfillmentClicked();
    //删除采购订单
    void onDeleteOrderClicked();
    //打开创建新订单对话框
    void onAddNewOrderClicked();
private:
    Ui::PurchaseOrderListDialog *ui;
    QSqlQueryModel *orderModel;
    //重写关闭事件
    void closeEvent(QCloseEvent *event);
    //设置表格
    void setupTable();
    //添加操作列按钮
    void addActionButtons(int row);
};

#endif // PURCHASEORDERLISTDIALOG_H
